package com.leijie.netty;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

import java.util.UUID;

/**
 * @author LeiJie
 * @time 2020-5-13 16:22
 * @desc TODO
 */
public class ServerHandle extends SimpleChannelInboundHandler<String> {
    @Override
    protected void channelRead0(ChannelHandlerContext ctx, String msg) throws Exception {
        System.out.println("客户端消息："+msg);
        Thread.sleep(1000);
        ctx.channel().writeAndFlush(UUID.randomUUID().toString());
    }


    @Override
    public void channelActive(ChannelHandlerContext ctx) throws Exception {

    }
}
